home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / c / icu-1.3.1 / icu-bin / include / ustring.h < prev    next >
C/C++ Source or Header  |  2000-02-23  |  5KB  |  164 lines

  1. /*
  2. *******************************************************************************
  3. *                                                                             *
  4. * COPYRIGHT:                                                                  *
  5. *   (C) Copyright International Business Machines Corporation, 1999           *
  6. *   Licensed Material - Program-Property of IBM - All Rights Reserved.        *
  7. *   US Government Users Restricted Rights - Use, duplication, or disclosure   *
  8. *   restricted by GSA ADP Schedule Contract with IBM Corp.                    *
  9. *                                                                             *
  10. *******************************************************************************
  11. *
  12. * File ustring.h
  13. *
  14. * Modification History:
  15. *
  16. *   Date        Name        Description
  17. *   12/07/98    bertrand    Creation.
  18. *******************************************************************************
  19. */
  20.  
  21. #ifndef USTRING_H
  22. #define USTRING_H
  23. #include "utypes.h"
  24.  
  25. /** 
  26.  * Determine the length of an array of UChar
  27.  * @param s The array of UChars, NULL (U+0000) terminated.
  28.  * @return The number of UChars in <TT>chars</TT>, minus the terminator.
  29.  */
  30. U_CAPI int32_t U_EXPORT2
  31. u_strlen(const UChar *s);
  32.  
  33. /**
  34.  * Concatenate two ustrings.  Appends a copy of <TT>src</TT>,
  35.  * including the null terminator, to <TT>dst</TT>. The initial copied
  36.  * character from <TT>src</TT> overwrites the null terminator in <TT>dst</TT>.
  37.  * @param dst The destination string.
  38.  * @param src The source string.
  39.  * @return A pointer to <TT>dst</TT>.
  40.  */
  41.  
  42. U_CAPI UChar* U_EXPORT2
  43. u_strcat(UChar     *dst, 
  44.     const UChar     *src);
  45.  
  46. /**
  47.  * Concatenate two ustrings.  
  48.  * Appends at most <TT>n</TT> characters from <TT>src</TT> to <TT>dst</TT>.
  49.  * Adds a null terminator.
  50.  * @param dst The destination string.
  51.  * @param src The source string.
  52.  * @param n The maximum number of characters to compare.
  53.  * @return A pointer to <TT>dst</TT>.
  54.  */
  55. U_CAPI UChar* U_EXPORT2
  56. u_strncat(UChar     *dst, 
  57.      const UChar     *src, 
  58.      int32_t     n);
  59.  
  60. /**
  61.  * Find the first occurrence of a specified character in a ustring.
  62.  * @param s The string to search.
  63.  * @param c The character to find.
  64.  * @return A pointer to the first occurrence of <TT>c</TT> in <TT>s</TT>,
  65.  * or a null pointer if <TT>s</TT> does not contain <TT>c</TT>.
  66.  */
  67. U_CAPI UChar*  U_EXPORT2
  68. u_strchr(const UChar     *s, 
  69.     UChar     c);
  70.  
  71. /**
  72.  * Compare two ustrings for bitwise equality.
  73.  * @param s1 A string to compare.
  74.  * @param s2 A string to compare.
  75.  * @return 0 if <TT>s1</TT> and <TT>s2</TT> are bitwise equal; a negative
  76.  * value if <TT>s1</TT> is bitwise less than <TT>s2,/TT>; a positive
  77.  * value if <TT>s1</TT> is bitwise greater than <TT>s2,/TT>.
  78.  */
  79. U_CAPI int32_t  U_EXPORT2
  80. u_strcmp(const UChar     *s1, 
  81.     const UChar     *s2);
  82.  
  83. /**
  84.  * Compare two ustrings for bitwise equality. 
  85.  * Compares at most <TT>n</TT> characters.
  86.  * @param s1 A string to compare.
  87.  * @param s2 A string to compare.
  88.  * @param n The maximum number of characters to compare.
  89.  * @return 0 if <TT>s1</TT> and <TT>s2</TT> are bitwise equal; a negative
  90.  * value if <TT>s1</TT> is bitwise less than <TT>s2,/TT>; a positive
  91.  * value if <TT>s1</TT> is bitwise greater than <TT>s2,/TT>.
  92.  */
  93. U_CAPI int32_t U_EXPORT2
  94. u_strncmp(const UChar     *ucs1, 
  95.      const UChar     *ucs2, 
  96.      int32_t     n);
  97.  
  98. /**
  99.  * Copy a ustring.
  100.  * Adds a null terminator.
  101.  * @param dst The destination string.
  102.  * @param src The source string.
  103.  * @return A pointer to <TT>dst</TT>.
  104.  */
  105. U_CAPI UChar* U_EXPORT2
  106. u_strcpy(UChar     *dst, 
  107.     const UChar     *src);
  108.  
  109. /**
  110.  * Copy a ustring.
  111.  * Copies at most <TT>n</TT> characters.  The result will be null terminated
  112.  * if the length of <TT>src</TT> is less than <TT>n</TT>.
  113.  * @param dst The destination string.
  114.  * @param src The source string.
  115.  * @param n The maximum number of characters to copy.
  116.  * @return A pointer to <TT>dst</TT>.
  117.  */
  118. U_CAPI UChar* U_EXPORT2
  119. u_strncpy(UChar     *dst, 
  120.      const UChar     *src, 
  121.      int32_t     n);
  122.  
  123. /**
  124.  * Copy a byte string encoded in the default codepage to a ustring.
  125.  * Adds a null terminator.
  126.  * performs a host byte to UChar conversion
  127.  * @param dst The destination string.
  128.  * @param src The source string.
  129.  * @return A pointer to <TT>dst</TT>.
  130.  */
  131. U_CAPI UChar* U_EXPORT2 u_uastrcpy(UChar *ucs1,
  132.                const char *s2 );
  133.  
  134. /**
  135.  * Copy a byte string encoded in the default codepage to a ustring.
  136.  * Copies at most <TT>n</TT> characters.  The result will be null terminated
  137.  * if the length of <TT>src</TT> is less than <TT>n</TT>.
  138.  * performs a host byte to UChar conversion
  139.  * @param dst The destination string.
  140.  * @param src The source string.
  141.  * @param n The maximum number of characters to copy.
  142.  * @return A pointer to <TT>dst</TT>.
  143.  */
  144. U_CAPI UChar* U_EXPORT2 u_uastrncpy(UChar *ucs1,
  145.             const char *s2,
  146.             int32_t n);
  147.  
  148. /**
  149.  * Copy ustring to a byte string encoded in the default codepage.
  150.  * Adds a null terminator.
  151.  * performs a UChar to host byte conversion
  152.  * @param dst The destination string.
  153.  * @param src The source string.
  154.  * @return A pointer to <TT>dst</TT>.
  155.  */
  156. U_CAPI char* U_EXPORT2 u_austrcpy(char *s1,
  157.             const UChar *us2 );
  158. #endif
  159.  
  160.  
  161.  
  162.  
  163.  
  164.